import $axios, { Result } from '@/plugins/axios'
import { AxiosResponse } from 'axios'
import { PageParam } from '@/type'

/**
 * 分页获取办理反馈审批列表
 * @param pageParam
 */
export async function getApproveList(
  pageParam: PageParam,
): Promise<AxiosResponse<Result>> {
  return await $axios.post(
    '/supervision-api/matterFeedback/getApproveList',
    pageParam,
  )
}

/**
 * 查询事项和任务数据，进行任务反馈审批
 * @param feedbackId
 */
export async function getApproveFormInfo(
  feedbackId: number,
): Promise<AxiosResponse<Result>> {
  return await $axios.get(
    `/supervision-api/matterFeedback/getApproveFormInfo`,
    {
      params: {
        feedbackId,
      },
    },
  )
}

/**
 * 审批通过
 * @param data
 */
export async function agreeFeedback(data: any): Promise<AxiosResponse<Result>> {
  return await $axios.post(`/supervision-api/matterFeedback/agree`, data)
}

/**
 * 审批不通过
 * @param data
 */
export async function disagreeFeedback(
  data: any,
): Promise<AxiosResponse<Result>> {
  return await $axios.post(`/supervision-api/matterFeedback/disagree`, data)
}
